<%@page import="edu.ncsu.csc.itrust.dao.mysql.OfficeVisitInstructionDAO"%>
<%@page import="edu.ncsu.csc.itrust.dao.mysql.OfficeVisitDAO"%>
<%@page import="edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO"%>
<%@page import="edu.ncsu.csc.itrust.beans.InstructionBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.OfficeVisitBean"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>

<%@include file="/global.jsp"%>

<%
	pageTitle = "iTrust - My Patient Specific Instructions";
%>

<%@include file="/header.jsp"%>

<%
loggingAction.logEvent(TransactionType.PATIENT_INSTRUCTIONS_VIEW, loggedInMID.longValue(), loggedInMID.longValue(), "Office Visit -- Really doesn't make sense");
OfficeVisitInstructionDAO oviDAO = DAOFactory.getProductionInstance().getOVInstructionDAO();
OfficeVisitDAO ovDAO = DAOFactory.getProductionInstance().getOfficeVisitDAO();
PersonnelDAO pDAO = DAOFactory.getProductionInstance().getPersonnelDAO();
%>
<div align="center">
<table class="fTable">
	<tr>
		<th align="center">Name</th>
		<th align="center">HCP</th>
		<th align="center">Comments</th>
		<th align="center">Office Visit Date</th>
		<th align="center">Add/Modification Date</th>
	</tr>
	<%if( oviDAO.getInstructionForPatient( loggedInMID.longValue() ).size() == 0 ){ %>
	<tr>
		<td colspan=5 align="center">No Specific Instructions</td>
	</tr>
	<% } else {%>
	<%for(InstructionBean b : oviDAO.getInstructionForPatient( loggedInMID.longValue() ) ) { 
				OfficeVisitBean ovbean = ovDAO.getOfficeVisit(b.getOVID());
				%>
	<tr>
		<td align="center"><a
			href="<%= StringEscapeUtils.escapeHtml("" + (b.getURL())) %>"><%= StringEscapeUtils.escapeHtml("" + (b.getDescriptName())) %></a></td>
		<td align="center"><%= StringEscapeUtils.escapeHtml("" + (pDAO.getName(b.getHCPID()))) %></td>
		<td align="center"><%= StringEscapeUtils.escapeHtml("" + (b.getComments())) %></td>
		<td align="center"><a
			href="<%= StringEscapeUtils.escapeHtml("./viewOfficeVisit.jsp?ovID=" + (b.getOVID())) %>"><%= StringEscapeUtils.escapeHtml("" + (ovbean.getVisitDateStr())) %></a></td>
		<td align="center"><%= StringEscapeUtils.escapeHtml("" + (b.getModDate())) %></td>
	</tr>
	<%} %>
	<%} %>
</table>
</div>

<%@include file="/footer.jsp"%>